﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data.SqlClient;
using Service.DAL;

namespace Service
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IRingtone
    {
        [OperationContract]
        List<Ringtone> GetNewRingtone(Category category, int number);

        [OperationContract]
        ID GetNewId(Category category);

        [OperationContract]
        long GetMaxId();

        [OperationContract]
        long GetLastId(Category category);

        [OperationContract]
        List<Ringtone> GetNextRingtone(Category category, long currentId, int number);

        [OperationContract]
        List<Ringtone> Search(string keyword, long currentId, int number);

        [OperationContract]
        bool IncreaseDownload(long code);
    }

    public class ID
    {
        Category _category;

        public Category Category
        {
            get { return _category; }
            set { _category = value; }
        }
        long _id;

        public long Id
        {
            get { return _id; }
            set { _id = value; }
        }
    }
    [DataContract]
    public class Ringtone
    {
        #region Fields
        private long _id;
        private long _code;
        private string _category;
        private string _title;
        private string _artist;
        private Uri _url;
        private long _download;
        private int _size;
        #endregion

        #region Properties

        [DataMember]
        public long Id
        {
            get { return _id; }
            set { _id = value; }
        }

        [DataMember]
        public long Code
        {
            get { return _code; }
            set { _code = value; }
        }

        [DataMember]
        public string Category
        {
            get { return _category; }
            set { _category = value; }
        }

        [DataMember]
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }

        [DataMember]
        public string Artist
        {
            get { return _artist; }
            set { _artist = value; }
        }

        [DataMember]
        public Uri Url
        {
            get { return _url; }
            set { _url = value; }
        }

        [DataMember]
        public long Download
        {
            get { return _download; }
            set { _download = value; }
        }

        [DataMember]
        public int Size
        {
            get { return _size; }
            set { _size = value; }
        }
        #endregion
    }
}
